<?php
//评论模型
namespace home\model;

use core\Model;

class CommentModel extends Model{
    //增加属性
    protected $table='comment';
//    获取指定博文的信息
    public function getAllComment($id){
        //通过sql获取评论信息
        $sql = "select c.*,u.u_username from {$this->getTable()} c left join {$this->getTable('user')} u on c.u_id = u.id where c.a_id = {$id} order by c.c_time desc";
        return $this->query($sql,true);
    }
}